Package com.fsf.news.utils
Class StringUtilsTest
java.lang.Object
com.fsf.news.utils.StringUtilsTest
Unit tests for the StringUtils class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testCollapseConsecutiveSymbols method.(package private) voidtestCollapseConsecutiveSymbols(String input, String expected) Tests that consecutive symbols are correctly collapsed in a string.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testDefaultString method.(package private) voidtestDefaultString(String input, String expected) Tests that the input is returned as is when non-null and as an empty string when null.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testDefaultStringWithDefault method.(package private) voidtestDefaultStringWithDefault(String input, String defaultStr, String expected) Tests that the input is returned as is when non-null and as the provided default string when null.Provides test data for the testIsBlank method.(package private) voidtestIsBlank(String input) Tests that a string is considered blank if it is null or empty.Provides test data for the testIsNotBlank method.(package private) voidtestIsNotBlank(String input) Tests that a string is not considered blank if it is not null or empty.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testRemoveHtmlTags method.(package private) voidtestRemoveHtmlTags(String input, String expected) Tests that HTML tags are correctly removed from a string.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testRemoveLeadingTrailingSymbols method.(package private) voidtestRemoveLeadingTrailingSymbols(String input, String expected) Tests that leading and trailing symbols are correctly removed from a string.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testRemoveLoneSymbols method.(package private) voidtestRemoveLoneSymbols(String input, String expected) Tests that lone symbols are correctly removed from a string.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testRemoveNonWordSymbols method.(package private) voidtestRemoveNonWordSymbols(String input, String expected) Tests that non-alphanumeric characters are correctly replaced with spaces in a string.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testRemoveUnderscoreSymbols method.(package private) voidtestRemoveUnderscoreSymbols(String input, String expected) Tests that underscore symbols are correctly removed from a string.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testReplaceSingleQuotes method.(package private) voidtestReplaceSingleQuotes(String input, String expected) Tests that single quotes are correctly replaced in a string.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testSplitTokens method.(package private) voidtestSplitTokens(String input, String[] expected) Tests that a string is correctly split into tokens.(package private) static Stream<org.junit.jupiter.params.provider.Arguments> Provides test data for the testWrapDoubleQuotes method.(package private) voidtestWrapDoubleQuotes(String input, String expected) Tests that a string is correctly wrapped in double quotes.
-
Constructor Details
-
StringUtilsTest
StringUtilsTest()
-
-
Method Details
-
testWrapDoubleQuotes
Tests that a string is correctly wrapped in double quotes.- Parameters:
input- the input stringexpected- the expected output string
-
testWrapDoubleQuotes
Provides test data for the testWrapDoubleQuotes method.- Returns:
- A stream of test data
-
testRemoveHtmlTags
Tests that HTML tags are correctly removed from a string.- Parameters:
input- the input stringexpected- the expected output string
-
testRemoveHtmlTags
Provides test data for the testRemoveHtmlTags method.- Returns:
- A stream of test data
-
testReplaceSingleQuotes
Tests that single quotes are correctly replaced in a string.- Parameters:
input- the input stringexpected- the expected output string
-
testReplaceSingleQuotes
Provides test data for the testReplaceSingleQuotes method.- Returns:
- A stream of test data
-
testRemoveNonWordSymbols
Tests that non-alphanumeric characters are correctly replaced with spaces in a string.- Parameters:
input- the input stringexpected- the expected output string
-
testRemoveNonWordSymbols
Provides test data for the testRemoveNonWordSymbols method.- Returns:
- A stream of test data
-
testCollapseConsecutiveSymbols
Tests that consecutive symbols are correctly collapsed in a string.- Parameters:
input- the input stringexpected- the expected output string
-
testCollapseConsecutiveSymbols
Provides test data for the testCollapseConsecutiveSymbols method.- Returns:
- A stream of test data
-
testRemoveLoneSymbols
Tests that lone symbols are correctly removed from a string.- Parameters:
input- the input stringexpected- the expected output string
-
testRemoveLoneSymbols
Provides test data for the testRemoveLoneSymbols method.- Returns:
- A stream of test data
-
testRemoveUnderscoreSymbols
Tests that underscore symbols are correctly removed from a string.- Parameters:
input- the input stringexpected- the expected output string
-
testRemoveUnderscoreSymbols
Provides test data for the testRemoveUnderscoreSymbols method.- Returns:
- A stream of test data
-
testRemoveLeadingTrailingSymbols
@ParameterizedTest @MethodSource void testRemoveLeadingTrailingSymbols(String input, String expected) Tests that leading and trailing symbols are correctly removed from a string.- Parameters:
input- the input stringexpected- the expected output string
-
testRemoveLeadingTrailingSymbols
Provides test data for the testRemoveLeadingTrailingSymbols method.- Returns:
- A stream of test data
-
testSplitTokens
Tests that a string is correctly split into tokens.- Parameters:
input- the input stringexpected- the expected array of tokens
-
testSplitTokens
Provides test data for the testSplitTokens method.- Returns:
- A stream of test data
-
testIsBlank
Tests that a string is considered blank if it is null or empty.- Parameters:
input- the input string
-
testIsBlank
Provides test data for the testIsBlank method.- Returns:
- A stream of test data
-
testIsNotBlank
Tests that a string is not considered blank if it is not null or empty.- Parameters:
input- the input string
-
testIsNotBlank
Provides test data for the testIsNotBlank method.- Returns:
- A stream of test data
-
testDefaultString
Tests that the input is returned as is when non-null and as an empty string when null.- Parameters:
input- the input string to be testedexpected- the expected result
-
testDefaultString
Provides test data for the testDefaultString method.- Returns:
- A stream of test data
-
testDefaultStringWithDefault
@ParameterizedTest @MethodSource void testDefaultStringWithDefault(String input, String defaultStr, String expected) Tests that the input is returned as is when non-null and as the provided default string when null.- Parameters:
input- the input stringdefaultStr- the default string to use if input is nullexpected- the expected result
-
testDefaultStringWithDefault
Provides test data for the testDefaultStringWithDefault method.- Returns:
- a stream of test data
-